package com.kssoft.ebd.service.impl;


import com.alibaba.fastjson.JSON;
import com.kssoft.ebd.service.BroadcastPageService;
import com.kssoft.ebd.spider.common.config.SpiderConfig;
import com.kssoft.ebd.spider.processor.CloseBroadcastProcessor;
import com.kssoft.ebd.spider.processor.HomeProcessor;
import com.kssoft.ebd.spider.processor.StartBroadcastProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class BroadcastPageServiceImpl implements BroadcastPageService {


    @Autowired
    private SpiderConfig spiderConfig;

    @Autowired
    private StartBroadcastProcessor startBroadcastProcessor;

    @Autowired
    private CloseBroadcastProcessor closeBroadcastProcessor;

    @Autowired
    private HomeProcessor homeProcessor;
    @Override
    public String homePage() {
        Map<String, String> homeCookies = homeProcessor.getHomeCookies();
        return JSON.toJSONString(homeCookies);
    }

    /**
     *  开播主页 Cookie
     * @return
     */
    @Override
    public String startBroadcastPage() {
        Map<String, String> startBroadcastCookies = startBroadcastProcessor.getStartBroadcastCookies();
        return JSON.toJSONString(startBroadcastCookies);
    }

    /**
     * 关播主页 Cookie
     * @return
     */
    @Override
    public String closeBroadcastPage() {
        Map<String, String> closeBroadcastCookies = closeBroadcastProcessor.getCloseBroadcastCookies();
        return JSON.toJSONString(closeBroadcastCookies);
    }

}
